package operateur;

/**
 * Interface definition : GestionColis
 * 
 * @author OpenORB Compiler
 */
public abstract class GestionColisPOA extends org.omg.PortableServer.Servant
        implements GestionColisOperations, org.omg.CORBA.portable.InvokeHandler
{
    public GestionColis _this()
    {
        return GestionColisHelper.narrow(_this_object());
    }

    public GestionColis _this(org.omg.CORBA.ORB orb)
    {
        return GestionColisHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:operateur/GestionColis:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    private static final java.util.Map operationMap = new java.util.HashMap();

    static {
            operationMap.put("accepterTransport",
                    new Operation_accepterTransport());
            operationMap.put("confirmationDepot",
                    new Operation_confirmationDepot());
            operationMap.put("confirmationRetraitColis",
                    new Operation_confirmationRetraitColis());
            operationMap.put("demandeRetraitTransporteur",
                    new Operation_demandeRetraitTransporteur());
            operationMap.put("deposer",
                    new Operation_deposer());
            operationMap.put("depotApresTransport",
                    new Operation_depotApresTransport());
            operationMap.put("getListeColisClient",
                    new Operation_getListeColisClient());
            operationMap.put("getListeColisEnAttenteDeDepot",
                    new Operation_getListeColisEnAttenteDeDepot());
            operationMap.put("retraitColis",
                    new Operation_retraitColis());
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        final AbstractOperation operation = (AbstractOperation)operationMap.get(opName);

        if (null == operation) {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }

        return operation.invoke(this, _is, handler);
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke_deposer(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = operateur.identHelper.read(_is);
        String arg1_in = operateur.identHelper.read(_is);
        String arg2_in = operateur.zoneHelper.read(_is);

        try
        {
            operateur.Rep_DepotInitial _arg_result = deposer(arg0_in, arg1_in, arg2_in);

            _output = handler.createReply();
            operateur.Rep_DepotInitialHelper.write(_output,_arg_result);

        }
        catch (operateur.Err_SoldeInsuffisant _exception)
        {
            _output = handler.createExceptionReply();
            operateur.Err_SoldeInsuffisantHelper.write(_output,_exception);
        }
        catch (operateur.Err_Zone _exception)
        {
            _output = handler.createExceptionReply();
            operateur.Err_ZoneHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_confirmationDepot(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        operateur.codeRFID arg0_in = operateur.codeRFIDHelper.read(_is);

        try
        {
            float _arg_result = confirmationDepot(arg0_in);

            _output = handler.createReply();
            operateur.soldeHelper.write(_output,_arg_result);

        }
        catch (operateur.Err_CodeRFID_Inexistant _exception)
        {
            _output = handler.createExceptionReply();
            operateur.Err_CodeRFID_InexistantHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_accepterTransport(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        operateur.codeRFID arg0_in = operateur.codeRFIDHelper.read(_is);
        String arg1_in = operateur.identHelper.read(_is);

        try
        {
            String _arg_result = accepterTransport(arg0_in, arg1_in);

            _output = handler.createReply();
            operateur.codeRetraitHelper.write(_output,_arg_result);

        }
        catch (operateur.Err_TransportAllreadyValidate _exception)
        {
            _output = handler.createExceptionReply();
            operateur.Err_TransportAllreadyValidateHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_demandeRetraitTransporteur(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = operateur.codeRetraitHelper.read(_is);

        try
        {
            operateur.codeRFID _arg_result = demandeRetraitTransporteur(arg0_in);

            _output = handler.createReply();
            operateur.codeRFIDHelper.write(_output,_arg_result);

        }
        catch (operateur.Err_CodeRetrait _exception)
        {
            _output = handler.createExceptionReply();
            operateur.Err_CodeRetraitHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_getListeColisEnAttenteDeDepot(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = operateur.identHelper.read(_is);
        String arg1_in = operateur.zoneHelper.read(_is);

        operateur.codeRFID[] _arg_result = getListeColisEnAttenteDeDepot(arg0_in, arg1_in);

        _output = handler.createReply();
        operateur.listRFIDHelper.write(_output,_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_retraitColis(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = operateur.identHelper.read(_is);
        String arg1_in = operateur.zoneHelper.read(_is);

        try
        {
            operateur.codeRFID _arg_result = retraitColis(arg0_in, arg1_in);

            _output = handler.createReply();
            operateur.codeRFIDHelper.write(_output,_arg_result);

        }
        catch (operateur.Err_NoColis _exception)
        {
            _output = handler.createExceptionReply();
            operateur.Err_NoColisHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_getListeColisClient(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = operateur.identHelper.read(_is);

        try
        {
            operateur.InfoColis[] _arg_result = getListeColisClient(arg0_in);

            _output = handler.createReply();
            operateur.listColisHelper.write(_output,_arg_result);

        }
        catch (operateur.Err_NoColis _exception)
        {
            _output = handler.createExceptionReply();
            operateur.Err_NoColisHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_depotApresTransport(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        operateur.codeRFID arg0_in = operateur.codeRFIDHelper.read(_is);

        depotApresTransport(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_confirmationRetraitColis(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        operateur.codeRFID arg0_in = operateur.codeRFIDHelper.read(_is);

        confirmationRetraitColis(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    // operation classes
    private abstract static class AbstractOperation {
        protected abstract org.omg.CORBA.portable.OutputStream invoke(
                GestionColisPOA target,
                org.omg.CORBA.portable.InputStream _is,
                org.omg.CORBA.portable.ResponseHandler handler);
    }

    private static final class Operation_deposer extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final GestionColisPOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_deposer(_is, handler);
        }
    }

    private static final class Operation_confirmationDepot extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final GestionColisPOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_confirmationDepot(_is, handler);
        }
    }

    private static final class Operation_accepterTransport extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final GestionColisPOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_accepterTransport(_is, handler);
        }
    }

    private static final class Operation_demandeRetraitTransporteur extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final GestionColisPOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_demandeRetraitTransporteur(_is, handler);
        }
    }

    private static final class Operation_getListeColisEnAttenteDeDepot extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final GestionColisPOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_getListeColisEnAttenteDeDepot(_is, handler);
        }
    }

    private static final class Operation_retraitColis extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final GestionColisPOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_retraitColis(_is, handler);
        }
    }

    private static final class Operation_getListeColisClient extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final GestionColisPOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_getListeColisClient(_is, handler);
        }
    }

    private static final class Operation_depotApresTransport extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final GestionColisPOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_depotApresTransport(_is, handler);
        }
    }

    private static final class Operation_confirmationRetraitColis extends AbstractOperation
    {
        protected org.omg.CORBA.portable.OutputStream invoke(
                final GestionColisPOA target,
                final org.omg.CORBA.portable.InputStream _is,
                final org.omg.CORBA.portable.ResponseHandler handler) {
            return target._invoke_confirmationRetraitColis(_is, handler);
        }
    }

}
